package com.example.alpha.campusbase.Fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.example.alpha.campusbase.Interface.BackHandleInterface;

/**
 * 详细聊天界面的碎片继承于
 */
public abstract class HandlerFragment extends Fragment {

    protected BackHandleInterface mBackHandleInterface;

    protected abstract Boolean onBackPressed();

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if(!(getActivity() instanceof BackHandleInterface)){
            throw new ClassCastException("Hosting Activity must implement BackHandledInterface");
        }else{
            this.mBackHandleInterface = (BackHandleInterface) getActivity();
        }
    }

    @Override
    public void onStart() {
        super.onStart();
        mBackHandleInterface.setSelectFragment(this);
    }
}
